package com.sgame.android.lang;

import android.content.Context;
import java.util.HashMap;

public enum ErrorMap
{
        SERVER_DOWN ( 109),
        UPGRADE_REQUIRED ( 110),
        USER_BANNED ( 111),
        AGREEMENT_NEEDED ( 112),
        BAD_REQUEST ( 400),
        UNAUTHORIZED ( 401),
        PERMISSION_DENIED ( 403),
        RECORD_NOT_FOUND ( 404),
        SERVER_ERROR ( 10001),
        NETWORK_UNAVAILABLE ( 10002),
        MISSING_DATA ( 10003),
        INVALID_DATA ( 10004),
        UNKNOWN_ERROR ( 10005),
        PARSE_ERROR ( 10006),
        NO_AUTH_TOKEN ( 10007),
        NO_CONSUMER_KEY ( 10008),
        MOBAGE_NOT_INITIALIZED ( 10009),
        SERVER_UNEXPECTED_RESPONSE ( 10010),
        NO_ACTIVE_CAMPAIGNS ( 10011),
        COMMON_APIINVALID_SESSION ( 20001),
        COMMON_APIMETHOD_MISSING_ARGUMENT ( 20002),
        COMMON_APIMETHOD_INVALID_ARGUMENT ( 20003),
        COMMON_APIMETHOD_NOT_IMPLEMENTED ( 20004),
        COMMON_APIMETHOD_NOT_SUPPORTED ( 20005),
        ANALYTICS_INVALID_RESPONSE ( 30001),
        ANALYTICS_SERVER_REJECTED_EVENT ( 30002),
        ANALYTICS_SERVER_EVENT_SIZE_TOO_LARGE ( 30003),
        ANALYTICS_SERVER_EVENT_PROPERTY_SIZE_TOO_LARGE ( 30004),
        ANALYTICS_SERVER_EVENT_CONTAINS_ARRAY ( 30005),
        BANK_ERROR_INVALID_STATE_TRANSITION ( 40001),
        BANK_ERROR_DEAD_TRANSACTION ( 40002),
        BANK_ERROR_GET_ITEM_FAIL ( 40003),
        BANK_ERROR_PURCHASE_FAIL ( 40004),
        BANK_ERROR_CREDIT_FAIL ( 40005),
        BANK_ERROR_OPEN_TRANSACTION ( 40006),
        BANK_ERROR_PROCESS_FAILURE ( 40007),
        BANK_ERROR_INVALID_CREDENTIALS ( 40008),
        CACHE_DISK_FAILED ( 50001),
        INVALID_CONFIGURATION ( 50002), 
        UI_ACTIVITY_ALREADY_SHOWING ( 60001),
        USER_CANCELLED ( 60002),
        LOGINREG_LOGIN_CANCELLED ( 0x11171),
        LOGINREG_NAME_TAKEN ( 0x11172),
        LOGINREG_REGISTRATION_CANCELLED ( 0x11173), 
        FACEBOOK_INVALID_SESSION ( 0x11174),
        FACEBOOK_ERROR ( 0x11175),
        FACEBOOK_CANCEL ( 0x11176),
        LOGINREG_ALREADY_IN_FLIGHT ( 0x11177),
        LOGGED_IN_WITH_A_DIFFERENT_USER ( 0x13881),
        GAME_NOT_OPENED_IN_MARKET ( 0x13882),
        TOO_MANY_FAILED_LOGIN_ATTEMPTS ( 0x15f91);

        private ErrorMap(int value) {
            this.code = value;
        }

        public static void Init(Context context)
        {
            ErrorMap aerrormap[];
            int i = (aerrormap = values()).length;
            for(int j = 0; j < i; j++)
            {
                ErrorMap errormap = aerrormap[j];
                a.put(Integer.valueOf(errormap.code), context.getString(Resource.a(context, (new StringBuilder("error_")).append(errormap.code).toString())));
            }

        }
        
        public int getCode() {
            return code;
        }

        public final String getDescription()
        {
            return description;
        }

        public final String getLocalizedDescription()
        {
            return description;
        }
        
        private static HashMap a = new HashMap();
        private int code;
        private String description;
}
